package com.atguigu.ssm.controller;

import com.atguigu.ssm.pojo.Employee;
import com.atguigu.ssm.service.EmployeeService;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class EmployeeController {

    @Autowired
    private EmployeeService employeeService;

    @GetMapping("/getOne/{id}")
    public Employee queryEmployeeOne(@PathVariable("id") int empId)  {
        return employeeService.queryEmployeeOne(empId);
    }

    @GetMapping("/page/{pageNum}/{pageSize}")
    public PageInfo<Employee> findPages(@PathVariable("pageNum") int pageNum,
                                        @PathVariable("pageSize") int pageSize) {
        return employeeService.findPages(pageNum,pageSize);
    }
}
